
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';

import 'package:test_app/core/base/base/base_view.dart';
import 'package:test_app/feature/home/details/details_controller.dart';
import 'package:test_app/core/design_system/extensions/widget/column_extension.dart';

class DetailsView extends BaseView<DetailsController> {

  const DetailsView({super.key});

  @override
  String? get navTitle => "详情";

  @override
  Widget body() {
    return  Obx(() {
      return [
        Text('第一行'),
        Text('第二行'),
        if (controller.detailsState.orderStr.value.isNotEmpty)
          Text(controller.detailsState.orderStr.value),
        TDButton(
          text: '跳转我的',
          type: TDButtonType.fill,
          onTap: () {
            controller.toMy();
          },
        ),
        TDButton(
          text: '跳转到订单',
          type: TDButtonType.fill,
          onTap: () {
            controller.toOrder();
          },
        ),
        TDButton(
          text: '存储本地数据',
          type: TDButtonType.fill,
          onTap: () {
            controller.setUserInfo();
          },
        )
      ].toColumn(spacing: 10.0);
    });
  }
}